xen.git
17 years agotools/hotplug: Separate OS-specific scripts.
Keir Fraser [Tue, 4 Nov 2008 12:13:42 +0000 (12:13 +0000)]
tools/hotplug: Separate OS-specific scripts.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: allow grant table originating ptes to have their guest available
Keir Fraser [Tue, 4 Nov 2008 11:46:00 +0000 (11:46 +0000)]
x86: allow grant table originating ptes to have their guest available
bits set.

In order to allow 2.6.27's get_user_pages_fast() to correctly detect
granted pages (so they would be passed to get_user_pages()), it must
be possible to tell the grant table code in Xen to set the three
available bits in the pte-s it creates.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoxentrace: Trace mmio/io read/write value
Keir Fraser [Mon, 3 Nov 2008 13:36:24 +0000 (13:36 +0000)]
xentrace: Trace mmio/io read/write value

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Fix GRANT_PTE_FLAGS.
Keir Fraser [Mon, 3 Nov 2008 10:32:54 +0000 (10:32 +0000)]
x86: Fix GRANT_PTE_FLAGS.

Since page table entries created through e.g. GNTTABOP_map_grant_ref
are being passed through adjust_guest_l1e(), they must not generally
get _PAGE_USER set - this will be taken care of by adjust_guest_l1e(),
and it will ensure that these don't get _PAGE_GLOBAL set
inadvertently.

Due to the implied security aspect here (_PAGE_GLOBAL getting set on
kernel pages for x86-64), I'd like to ask that this also be applied to
older maintained branches.

At the same time, set _PAGE_NX for pte-s created for grants (as long
as hardware supports it), since it should be only data pages that remote
domains are being given access to.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: simplify page reference handling for partially (in-)validated pages
Keir Fraser [Mon, 3 Nov 2008 10:32:02 +0000 (10:32 +0000)]
x86: simplify page reference handling for partially (in-)validated pages

Simplify general page reference management for preempted (partially
[in-]validated) pages: Reserve on reference that can be acquired
without the risk of overflowing the reference count, thus allowing to
have a simplified get_page() equivalent that cannot fail (but must be
used with care).

Doing this conversion pointed out a latent issue in the changes done
previously in this area: The extra reference must be acquired before
the 'normal' reference gets dropped, so the patch fixes this at once
in both the alloc_page_type() and free_page_type() paths (it's really
only the latter that failed to work with the change described above).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoCpufreq: Enhance hypervisor px sanity check
Keir Fraser [Mon, 3 Nov 2008 10:24:17 +0000 (10:24 +0000)]
Cpufreq: Enhance hypervisor px sanity check

This patch enhances hypervisor px sanity check in 2 level:
Firstly, move per-cpu-level px sanity check from each cpufreq driver
to common point (@ hypercall path). Secondly, add per-domain-level px
sanity check to common point (@ cpufreq_add_cpu).

Signed-off-by: Jinsong Liu <jinsong.liu@intel.com>
17 years agoxend: ioport & irq persistence thru reboot
Keir Fraser [Mon, 3 Nov 2008 10:23:09 +0000 (10:23 +0000)]
xend: ioport & irq persistence thru reboot

When a domU is configured for a serial port as documented at:
   http://wiki.xensource.com/xenwiki/InstallationNotes

the VM does see the serial port, however when dom0 is rebooted and
the VM started it no longer has access to the serial port.

xm list -l <vm> no longer shows the ioports or irq attributes

Attached patch adds implementation of getDeviceConfiguration(),
returns details dict and implements waitForDevice() to irqif.py and
iopif.py.

Also added preprocess_irq() to create.py.

Signed-off-by: Pat Campbell <plc@novell.com>
17 years agoChange timer implementation to allow variable 'slop' in how late
Keir Fraser [Fri, 31 Oct 2008 14:02:39 +0000 (14:02 +0000)]
Change timer implementation to allow variable 'slop' in how late
timers are fired. The default continues to be 50us, but this can be
configured on Xen's command line.

Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Use the right error code when testing for spurious pagefaults
Keir Fraser [Thu, 30 Oct 2008 15:04:27 +0000 (15:04 +0000)]
x86: Use the right error code when testing for spurious pagefaults

Shadowed PV domains may take pagefaults with PFEC_reserved_bit bit
set, which are then turned into page-not-present faults by the shadow
code. Since that changes the error code in the regs structure, we need
to remember the old error code when we later check for spurious page
faults or we'll get false positives.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
17 years agox86: fix preemptable page type handling
Keir Fraser [Thu, 30 Oct 2008 14:53:24 +0000 (14:53 +0000)]
x86: fix preemptable page type handling

- retain a page reference when PGT_partial is set on a page (and drop
  it when clearing that flag)
- don't drop a page reference never acquired when freeing the page
  type
  of a page where the allocation of the type got preempted (and never
  completed)
- don't acquire a page reference when allocating the page type of a
  page where freeing the type got preempted (and never completed, and
  hence didn't drop the respective reference)

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: eliminate domain cleanup hack in favor of using the preemptable
Keir Fraser [Thu, 30 Oct 2008 14:37:48 +0000 (14:37 +0000)]
x86: eliminate domain cleanup hack in favor of using the preemptable
flavors of the respective functions.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoCPUIDLE: Support C1 FFH entry
Keir Fraser [Thu, 30 Oct 2008 13:33:40 +0000 (13:33 +0000)]
CPUIDLE: Support C1 FFH entry

Add support for C1 FFH (mwait) entry. Meanwhile add timing for C1. The
timing for C1 should be accurate for FFH case, but may not for halt case.

Signed-off-by: Wei Gang <gang.wei@intel.com>
17 years agoCPUIDLE: add idx field
Keir Fraser [Thu, 30 Oct 2008 13:33:17 +0000 (13:33 +0000)]
CPUIDLE: add idx field

This patch adds an idx field in the 'struct acpi_processor_cx'. It can
simplify some coding lines.

Signed-off-by: Guanqun Lu <guanqun.lu@intel.com>
Signed-off-by: Wei Gang <gang.wei@intel.com>=
17 years agorombios: fix int13h for floppy disk
Keir Fraser [Thu, 30 Oct 2008 13:27:07 +0000 (13:27 +0000)]
rombios: fix int13h for floppy disk

A floppy on HVM can't be read correctly.
This fix is taken from upstream bochs-2.3.7.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
17 years agocpufreq: Fix another build failure.
Keir Fraser [Wed, 29 Oct 2008 19:06:52 +0000 (19:06 +0000)]
cpufreq: Fix another build failure.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
17 years agocpufreq.c: shut up compiler about cpufreq_dom
Keir Fraser [Wed, 29 Oct 2008 16:58:05 +0000 (16:58 +0000)]
cpufreq.c: shut up compiler about cpufreq_dom

Some versions of GCC are too stupid to figure out that cpufreq_dom is
only used if !!domexist and always set in that case, and complain that
it may be used uninitialised.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
17 years agox86: Fix relinquish_memory() for PGT_partial pages.
Keir Fraser [Wed, 29 Oct 2008 13:09:37 +0000 (13:09 +0000)]
x86: Fix relinquish_memory() for PGT_partial pages.

Original patch by Jan Beulich.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agominios: Define __INSIDE_MINIOS__ rather than __MINIOS__
Keir Fraser [Wed, 29 Oct 2008 12:04:38 +0000 (12:04 +0000)]
minios: Define __INSIDE_MINIOS__ rather than __MINIOS__

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
17 years agox86: Specify NUMA node when alloc'ing compat l4 for 32-on-64 guest
Keir Fraser [Wed, 29 Oct 2008 10:19:35 +0000 (10:19 +0000)]
x86: Specify NUMA node when alloc'ing compat l4 for 32-on-64 guest
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agocpufreq: domain structure update from array to linked list
Keir Fraser [Wed, 29 Oct 2008 10:14:13 +0000 (10:14 +0000)]
cpufreq: domain structure update from array to linked list

Current cpufreq domain is an array cpufreq_dom_map[NR_CPUS].
However, domain number may be sparse or bigger than NR_CPUS.

Signed-off-by: Jinsong Liu <jinsong.liu@intel.com>
17 years agox86: Fix circular page reference destruction in relinquish_memory().
Keir Fraser [Tue, 28 Oct 2008 11:25:20 +0000 (11:25 +0000)]
x86: Fix circular page reference destruction in relinquish_memory().

Tested by Jan Beulich and fixes a memory leak, but there is more to be
done here.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxend: Fix typo in waitForBackend() for phantom VBDs
Keir Fraser [Tue, 28 Oct 2008 10:37:30 +0000 (10:37 +0000)]
xend: Fix typo in waitForBackend() for phantom VBDs

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
17 years agohvm: Do not mess with APIC timer deadline if in one-shot mode.
Keir Fraser [Tue, 28 Oct 2008 10:36:22 +0000 (10:36 +0000)]
hvm: Do not mess with APIC timer deadline if in one-shot mode.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxenoprof: Small fixes.
Keir Fraser [Tue, 28 Oct 2008 10:35:15 +0000 (10:35 +0000)]
xenoprof: Small fixes.

Signed-off-by: Ronghui Duan <ronghui.duan@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agominios: do not expose #define current to applications
Keir Fraser [Mon, 27 Oct 2008 18:51:52 +0000 (18:51 +0000)]
minios: do not expose #define current to applications

Currently the minios headers do this:
 #define current get_current()
Obviously when porting general code to this environment, this can
cause problems !

The attached patch arranges for this only to be done if
 #define __MINIOS__
is declared, which is set up by the makefile in extras/mini-os.

Suppressing the namespace pollution is necessary to get recent
upstream qemu's to compile, since they (quite properly) use `current'
as an ordinary identifier.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
17 years agox86: Disable MSI IRQs until locking is fixed.
Keir Fraser [Mon, 27 Oct 2008 14:59:01 +0000 (14:59 +0000)]
x86: Disable MSI IRQs until locking is fixed.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86, hvm, xenoprof: Add fully support of HVM guest to xenoprofile on Intel P6.
Keir Fraser [Mon, 27 Oct 2008 13:31:15 +0000 (13:31 +0000)]
x86, hvm, xenoprof: Add fully support of HVM guest to xenoprofile on Intel P6.

Signed-off-by: Ronghui Duan <ronghui.duan@intel.com>
17 years agox86: highmem handling assistance hypercalls
Keir Fraser [Mon, 27 Oct 2008 13:29:35 +0000 (13:29 +0000)]
x86: highmem handling assistance hypercalls

While looking at the origin of very frequently executed hypercalls I
realized that the high page accessor functions in Linux would be good
candidates to handle in the hypervisor - clearing or copying to/from
a high page is a pretty frequent operation (provided there's enough
memory in the domain). While prior to the first submission I only
measured kernel builds (where the results are not hinting at a
meaningful improvement), I now found time to do a more specific
analysis: page clearing is being improved by about 20%, page copying
doesn't seem to significantly benefit (though that may be an effect of
the simplistic copy_page() implementation Xen currently uses) -
nevertheless I would think that if one function is supported by the
hypervisor, then the other should also be.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoConstify arguments to unmap_domain_page() etc.
Keir Fraser [Mon, 27 Oct 2008 13:27:33 +0000 (13:27 +0000)]
Constify arguments to unmap_domain_page() etc.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: First fixmap entry (0) is invalid.
Keir Fraser [Mon, 27 Oct 2008 13:26:50 +0000 (13:26 +0000)]
x86: First fixmap entry (0) is invalid.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoPrint d->is_dying when dumping domain info.
Keir Fraser [Mon, 27 Oct 2008 13:23:58 +0000 (13:23 +0000)]
Print d->is_dying when dumping domain info.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: fix domain cleanup
Keir Fraser [Mon, 27 Oct 2008 13:22:43 +0000 (13:22 +0000)]
x86: fix domain cleanup

The preemptable page type handling changes modified free_page_type()
behavior without adjusting the call site in relinquish_memory(): Any
type reference left pending when leaving hypercall handlers is
associated with a page reference, and when successful free_page_type()
decrements the type refcount - hence relinquish_memory() must now also
drop the page reference.

Also, the recursion avoidance during domain shutdown somehow (probably
by me when I merged the patch up to a newer snapshot) got screwed up:
The avoidance logic in mm.c should short circuit levels below the top
one currently being processed, rather than the top one itself.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86/powernow: fix machine shutdown
Keir Fraser [Mon, 27 Oct 2008 13:20:52 +0000 (13:20 +0000)]
x86/powernow: fix machine shutdown

cpufreq_del_cpu() calls cpufreq_driver->exit() without checking
whether an exit() handler is present, and by adding an exit() handler
to powernow we can at once close the potential memory leak.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: Fix coding style in msi.c
Keir Fraser [Mon, 27 Oct 2008 11:56:57 +0000 (11:56 +0000)]
x86: Fix coding style in msi.c
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoserial: Fix IRQ enable/disable in tx interrupt handler.
Keir Fraser [Mon, 27 Oct 2008 11:27:31 +0000 (11:27 +0000)]
serial: Fix IRQ enable/disable in tx interrupt handler.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86_32: Lock in map_domain_page() may be taken with IRQs disabled, and
Keir Fraser [Mon, 27 Oct 2008 10:49:20 +0000 (10:49 +0000)]
x86_32: Lock in map_domain_page() may be taken with IRQs disabled, and
hence must *always* disable IRQs.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoAdd 2 more permissions to the XSM/Flask default policy.
Keir Fraser [Mon, 27 Oct 2008 10:29:39 +0000 (10:29 +0000)]
Add 2 more permissions to the XSM/Flask default policy.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
17 years agox86: relax restrictions on reserved bits in L3 for 32on64 x86 guests
Keir Fraser [Mon, 27 Oct 2008 10:08:48 +0000 (10:08 +0000)]
x86: relax restrictions on reserved bits in L3 for 32on64 x86 guests

A 32on64 guest cannot copy an existing pinned L3 entry to use as a new
L3 because COMPAT_L3_DISALLOW_MASK contains bits which are added to L3
entries by adjust_guest_l3e (U/S & R/W) or by the hardware (A & D).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
17 years agoCpufreq statistic update for SW_ANY coordination
Keir Fraser [Mon, 27 Oct 2008 10:06:58 +0000 (10:06 +0000)]
Cpufreq statistic update for SW_ANY coordination

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
17 years agoFix xm scsi-attach/detach/list for inactive managed domains
Keir Fraser [Mon, 27 Oct 2008 10:03:17 +0000 (10:03 +0000)]
Fix xm scsi-attach/detach/list for inactive managed domains

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
17 years agox86: Enable spinlock debugging earlier during boot.
Keir Fraser [Thu, 23 Oct 2008 14:38:52 +0000 (15:38 +0100)]
x86: Enable spinlock debugging earlier during boot.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Dom0 builder doesn't need to disable IRQs while running on dom0 pagetables.
Keir Fraser [Thu, 23 Oct 2008 14:38:27 +0000 (15:38 +0100)]
x86: Dom0 builder doesn't need to disable IRQs while running on dom0 pagetables.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Dom0 builder must run on a valid GDT at all times.
Keir Fraser [Thu, 23 Oct 2008 14:34:27 +0000 (15:34 +0100)]
x86: Dom0 builder must run on a valid GDT at all times.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoRemove accidentally checked-in xenpmd binary.
Keir Fraser [Thu, 23 Oct 2008 14:23:15 +0000 (15:23 +0100)]
Remove accidentally checked-in xenpmd binary.

17 years agohpet cpuidle: Observe IRQ-safe locking protocol.
Keir Fraser [Thu, 23 Oct 2008 11:01:03 +0000 (12:01 +0100)]
hpet cpuidle: Observe IRQ-safe locking protocol.

Otherwise, may encounter deadlock.

Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agospinlock: Add debug-build checks for IRQ-safe spinlocks.
Keir Fraser [Thu, 23 Oct 2008 10:53:52 +0000 (11:53 +0100)]
spinlock: Add debug-build checks for IRQ-safe spinlocks.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86, hvm: Move return-to-guest timer and interrupt cranking logic
Keir Fraser [Thu, 23 Oct 2008 10:40:59 +0000 (11:40 +0100)]
x86, hvm: Move return-to-guest timer and interrupt cranking logic
outside of IRQ-safe context. This allows us to safely take
non-IRQ-safe spinlocks.

The drawback is that {vmx,svm}_intr_assist() now races new event
notifications delivered by IRQ or IPI. We close down this race by
having vcpu_kick() send a dummy softirq -- this gets picked up in
IRQ-sage context and will cause retry of *_intr_assist(). We avoid
delivering the softirq where possible by avoiding it when we are
running in the non-IRQ context of the VCPU to be kicked.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxenpmd: Fix makefile for 'make install'.
Keir Fraser [Thu, 23 Oct 2008 10:20:44 +0000 (11:20 +0100)]
xenpmd: Fix makefile for 'make install'.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agohvmloader: Remove unneeded legacy flag from FADT flags field.
Keir Fraser [Thu, 23 Oct 2008 10:18:34 +0000 (11:18 +0100)]
hvmloader: Remove unneeded legacy flag from FADT flags field.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
rHG: changed tools/firmware/hvmloader/acpi/static_tables.c

17 years agoXen power management daemon patch.
Keir Fraser [Thu, 23 Oct 2008 10:17:25 +0000 (11:17 +0100)]
Xen power management daemon patch.

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
17 years agox86, smpboot: A few code cleanups.
Keir Fraser [Wed, 22 Oct 2008 15:47:44 +0000 (16:47 +0100)]
x86, smpboot: A few code cleanups.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoRemove duplicated __cacheline_aligned attribute from irq_desc arrays
Keir Fraser [Wed, 22 Oct 2008 15:41:33 +0000 (16:41 +0100)]
Remove duplicated __cacheline_aligned attribute from irq_desc arrays

Remove duplicated __cacheline_aligned attribute, as it's
already included in type declaration.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
17 years agoRemove unused old xmalloc.c file.
Keir Fraser [Wed, 22 Oct 2008 15:39:37 +0000 (16:39 +0100)]
Remove unused old xmalloc.c file.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Remove needless IRQ critical section from init_xen_time().
Keir Fraser [Wed, 22 Oct 2008 14:11:54 +0000 (15:11 +0100)]
x86: Remove needless IRQ critical section from init_xen_time().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agospinlock: Add assertions for lock_irq() variants.
Keir Fraser [Wed, 22 Oct 2008 14:07:30 +0000 (15:07 +0100)]
spinlock: Add assertions for lock_irq() variants.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoDefine spin_barrier_irq() for IRQ-safe spinlocks, and use it for virq_lock.
Keir Fraser [Wed, 22 Oct 2008 14:06:01 +0000 (15:06 +0100)]
Define spin_barrier_irq() for IRQ-safe spinlocks, and use it for virq_lock.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86, hvm: Allow 100us periodic virtual timers
Keir Fraser [Wed, 22 Oct 2008 11:08:16 +0000 (12:08 +0100)]
x86, hvm: Allow 100us periodic virtual timers

Adjust vpt and hpet minimum period (for timers) from 900us to 100us to
be able to pass Windows 2008 compatibility tests.

Signed-off-by: Peter Johnston <peter.johnston@citrix.com>
17 years agoPort HPET device model to vpt timer subsystem
Keir Fraser [Wed, 22 Oct 2008 11:04:32 +0000 (12:04 +0100)]
Port HPET device model to vpt timer subsystem

The current hpet implementation runs a one-shot xen timer for each
hpet timer whenever the main counter is enabled regardless of whether
or not the individual hpet timers are enabled.  When the timer fires,
if it is enabled the interrupt is routed to the guest.  If the hpet
timer is periodic, a new one-shot timer is set, for NOW()+period.
There are a number of problems with this the most significant is guest
time drift.  Windows does not read the hardware clock to verify time,
it depends on timer interrupts firing at the expected interval.  The
existing implementation queues a new one-shot timer each time it fires
and does not allow for a difference between NOW() and the time the
timer was expected to fire, causing drift.  Also there is
no allowance for lost ticks. This modification changes HPET to use the
Virtual Platform Timer (VPT) and, for periodic timers, to use periodic
timers.  The VPT ensures an interrupt is delivered to the guest for
each period that elapses, plus, its use of xen periodic timers ensures
no drift.

Signed-off-by: Peter Johnston <peter.johnston@citrix.com>
17 years agoEPT: tidy exception handler to give more useful errors
Keir Fraser [Wed, 22 Oct 2008 10:59:19 +0000 (11:59 +0100)]
EPT: tidy exception handler to give more useful errors

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
17 years agox86, hap: Track max_mapped_pfn better when using 2MB p2m mappings.
Keir Fraser [Wed, 22 Oct 2008 10:58:20 +0000 (11:58 +0100)]
x86, hap: Track max_mapped_pfn better when using 2MB p2m mappings.

The test for when to increase it was not quite right; also on EPT
the value it was set to didn't count the top 511 frames.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
17 years agoFix guest_physmap_add_entry sanity checking logic
Keir Fraser [Wed, 22 Oct 2008 10:56:44 +0000 (11:56 +0100)]
Fix guest_physmap_add_entry sanity checking logic

Fix the logic of the p->m and m->p mapping sanity checks and fixup in
guest_physmap_add_entry().

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
17 years agoblktap: re-enable O_DIRECT in block_qcow.c
Keir Fraser [Wed, 22 Oct 2008 10:55:33 +0000 (11:55 +0100)]
blktap: re-enable O_DIRECT in block_qcow.c

Turns out that only two reads and writes in block-qcow.c need to be
fixed to work correctly with O_DIRECT.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
17 years agoSimplify set_px_info hypercall 32-on-64 compatibility shim.
Keir Fraser [Wed, 22 Oct 2008 10:53:51 +0000 (11:53 +0100)]
Simplify set_px_info hypercall 32-on-64 compatibility shim.

Mark processor_px as 'checking' and translate handle to simplify
actual code doing in the translation.
(According to Jan Beulich's suggestion)

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
17 years ago[IA64] Add head files and helper functions for VTD/ia64
Isaku Yamahata [Wed, 22 Oct 2008 08:20:15 +0000 (17:20 +0900)]
[IA64] Add head files and helper functions for VTD/ia64

Add head files and helper functions for VTD/ia64.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
17 years ago[IA64]: update ia64 px info transfer corresponding to x86 px info update.
Isaku Yamahata [Wed, 22 Oct 2008 03:41:52 +0000 (12:41 +0900)]
[IA64]: update ia64 px info transfer corresponding to x86 px info update.

update ia64 px info transfer corresponding to x86 px info update.

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
17 years ago[IA64] Add hypercalls needed for VTD
Isaku Yamahata [Wed, 22 Oct 2008 03:40:06 +0000 (12:40 +0900)]
[IA64] Add hypercalls needed for VTD

Add hypercalls needed for VTD.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
17 years agomerge with xen-unstable.hg
Isaku Yamahata [Wed, 22 Oct 2008 02:46:55 +0000 (11:46 +0900)]
merge with xen-unstable.hg

17 years ago[IA64] fix compilation error of xen/common/spinlock.c
Isaku Yamahata [Wed, 22 Oct 2008 02:38:22 +0000 (11:38 +0900)]
[IA64] fix compilation error of xen/common/spinlock.c

This patch fixes the error in the x86 tree.
> spinlock.c: In function _spin_lock_recursive:
> spinlock.c:59: error: dereferencing pointer to incomplete type

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years agoia64: Some fixes after spinlock implementation changes.
Keir Fraser [Tue, 21 Oct 2008 17:00:21 +0000 (18:00 +0100)]
ia64: Some fixes after spinlock implementation changes.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86, shadow: shadow_page_info must be same size as page_info.
Keir Fraser [Tue, 21 Oct 2008 13:15:11 +0000 (14:15 +0100)]
x86, shadow: shadow_page_info must be same size as page_info.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Move some code out of IRQ-disabled section of context switch path.
Keir Fraser [Tue, 21 Oct 2008 13:14:37 +0000 (14:14 +0100)]
x86: Move some code out of IRQ-disabled section of context switch path.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86, irq: No synamic memory allocation with IRQs disabled.
Keir Fraser [Tue, 21 Oct 2008 13:13:54 +0000 (14:13 +0100)]
x86, irq: No synamic memory allocation with IRQs disabled.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoUse hvm_dirq_assist() to replace {vmx,svm}_dirq_assist().
Keir Fraser [Tue, 21 Oct 2008 10:44:39 +0000 (11:44 +0100)]
Use hvm_dirq_assist() to replace {vmx,svm}_dirq_assist().
Do not compile some IA64 MSI-related parts.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
17 years agoxend: Fix and clean up vscsi_util.py and other files
Keir Fraser [Tue, 21 Oct 2008 10:43:21 +0000 (11:43 +0100)]
xend: Fix and clean up vscsi_util.py and other files

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
17 years agotimer: No dynamic memory allocation with IRQs disabled.
Keir Fraser [Tue, 21 Oct 2008 10:39:57 +0000 (11:39 +0100)]
timer: No dynamic memory allocation with IRQs disabled.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Avoid dynamic memory allocation during AP startup.
Keir Fraser [Tue, 21 Oct 2008 10:39:22 +0000 (11:39 +0100)]
x86: Avoid dynamic memory allocation during AP startup.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agopv-on-hvm: Avoid rwlock livelock on save/restore.
Keir Fraser [Tue, 21 Oct 2008 09:04:40 +0000 (10:04 +0100)]
pv-on-hvm: Avoid rwlock livelock on save/restore.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoFix ioapic_rte_to_remap_entry() on IA64.
Keir Fraser [Tue, 21 Oct 2008 08:53:34 +0000 (09:53 +0100)]
Fix ioapic_rte_to_remap_entry() on IA64.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
17 years agoAdd print info for ACPI _PCT and _PPC
Keir Fraser [Tue, 21 Oct 2008 08:49:19 +0000 (09:49 +0100)]
Add print info for ACPI _PCT and _PPC

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
17 years agoUpdate cpufreq statistic protection
Keir Fraser [Tue, 21 Oct 2008 08:48:56 +0000 (09:48 +0100)]
Update cpufreq statistic protection

For struct pm_px, there are 3 pointer: pxpt, pt, trans_pt.
Partly free pointer 'pt' and 'trans_pt' will result in little memory
leak, and what is more, will result in protection issue when user
access px statistic info through libxc.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
17 years agoAdd protection for xenpm access power management info
Keir Fraser [Tue, 21 Oct 2008 08:48:08 +0000 (09:48 +0100)]
Add protection for xenpm access power management info

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
17 years agox86: Adapt 32b guest os to 64b hypervisor platform_hypercall compatibility
Keir Fraser [Tue, 21 Oct 2008 08:47:33 +0000 (09:47 +0100)]
x86: Adapt 32b guest os to 64b hypervisor platform_hypercall compatibility

Changeset 18552 (19b0a4f91712) move px transfer logic from
platform_hypercall.c to a common file to support both x86 and
ia64. However, it involves 32b guest os to 64b hypervisor (x86)
compatible issue. This patch fix the compatible issue, and make
set_px_pminfo() re-used by ia64 and x86 (32b guest os to 64b
hypervisor, and 64b guest os to 64b hypervisor).

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
17 years agox86, spinlock: Always inline raw spinlock functions.
Keir Fraser [Mon, 20 Oct 2008 16:45:36 +0000 (17:45 +0100)]
x86, spinlock: Always inline raw spinlock functions.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86, spinlock: Get rid of .text.lock out-of-line section.
Keir Fraser [Mon, 20 Oct 2008 16:17:55 +0000 (17:17 +0100)]
x86, spinlock: Get rid of .text.lock out-of-line section.

We don't care about code bloat now that spinlock operations are not
inlined into callers. This will make backtraces easier to read.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agospinlock: Modify recursive spinlock definitions to support up to 4095 CPUs.
Keir Fraser [Mon, 20 Oct 2008 16:16:45 +0000 (17:16 +0100)]
spinlock: Modify recursive spinlock definitions to support up to 4095 CPUs.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Add TLB flushing to HAP p2m changes
Keir Fraser [Mon, 20 Oct 2008 15:49:25 +0000 (16:49 +0100)]
x86: Add TLB flushing to HAP p2m changes

Removing an MFN from the p2m requires it to be flushed from the
guest's TLBs on HAP, like we do when we're using shadows.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
17 years agoClean up spinlock operations and compile as first-class functions.
Keir Fraser [Mon, 20 Oct 2008 15:48:17 +0000 (16:48 +0100)]
Clean up spinlock operations and compile as first-class functions.

This follows modern Linux, since apparently outlining spinlock
operations does not slow down execution. The cleanups will also allow
more convenient addition of diagnostic code.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agovmx: avoid taking locks with irqs disabled
Keir Fraser [Mon, 20 Oct 2008 14:31:54 +0000 (15:31 +0100)]
vmx: avoid taking locks with irqs disabled

Shuffle the bits of the vmexit handler that run with EFLAGS.IF == 0 up
to the top.  Otherwise we end up calling spin_lock() with interrupts
disabled, which can deadlock against the time-synchronization
rendezvous code.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
17 years agox86: add movnti emulation
Keir Fraser [Mon, 20 Oct 2008 14:22:58 +0000 (15:22 +0100)]
x86: add movnti emulation

Linux added the use of movnti for copying from user to kernel space in
certain cases, and as per reports we got this may happen with the
destination being in MMIO.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoVT-d: correct allocation failure checks
Keir Fraser [Mon, 20 Oct 2008 14:19:39 +0000 (15:19 +0100)]
VT-d: correct allocation failure checks

Checking the return value of map_domain_page() (and hence
map_vtd_domain_page()) against NULL is pointless, checking the return
value of alloc_domheap_page() (and thus alloc_pgtable_maddr()) is
mandatory, however.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agodocs: Update XenAPI document for pvSCSI
Keir Fraser [Mon, 20 Oct 2008 14:18:09 +0000 (15:18 +0100)]
docs: Update XenAPI document for pvSCSI

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
17 years agoxend: fix setting vcpus > VCPUs_max
Keir Fraser [Mon, 20 Oct 2008 14:17:24 +0000 (15:17 +0100)]
xend: fix setting vcpus > VCPUs_max

From reading xend code related to changing number of vcpus it appears
setting the number of vcpus to a value greater than VCPUs_max is not
allowed on a running domain.  This restriction is not honored by
setVCpuCount() in XendDomainInfo.py.  Attached patch makes
setVCpuCount() fail if vcpus > VCPUs_max and domain is running.

Also, I think the changes should be reflected in managed config of
running domain if in fact the domain is managed - so unconditionally
call managed_config_save().

BTW, the original code is rather confusing.  Essentially the same
actions are taken regardless if self.info['VCPUs_max'] > vcpus, just
the order of invocation is changed.  But this doesn't seem to matter
since self.info['VCPUs_live'] is not subsequently used.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
17 years agoAdd some necessary files to build IA64 VT-d.
Keir Fraser [Mon, 20 Oct 2008 14:15:19 +0000 (15:15 +0100)]
Add some necessary files to build IA64 VT-d.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
17 years agovtd: make the xen_in_range/tboot_in_range checkings also work for IA64.
Keir Fraser [Mon, 20 Oct 2008 14:14:55 +0000 (15:14 +0100)]
vtd: make the xen_in_range/tboot_in_range checkings also work for IA64.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
17 years agoDefine a macro IO_APIC_ID() for x86.
Keir Fraser [Mon, 20 Oct 2008 14:13:50 +0000 (15:13 +0100)]
Define a macro IO_APIC_ID() for x86.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
17 years agoiommu: make some functions (mainly MSI-related) dummy on IA64 for now.
Keir Fraser [Mon, 20 Oct 2008 14:13:02 +0000 (15:13 +0100)]
iommu: make some functions (mainly MSI-related) dummy on IA64 for now.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
17 years agoAdd a new file xen/include/xen/hvm/irq.h to share common definitions.
Keir Fraser [Mon, 20 Oct 2008 14:11:41 +0000 (15:11 +0100)]
Add a new file xen/include/xen/hvm/irq.h to share common definitions.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
17 years agoNMI watchdog: don't try to run too slow.
Keir Fraser [Mon, 20 Oct 2008 14:11:19 +0000 (15:11 +0100)]
NMI watchdog: don't try to run too slow.

The way MSR writes of performance counters works means that Intel
CPUs running faster than about 2.1GHz can't set the NMI timer to 1Hz.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
17 years agoblktap: Handle qcow backing files correctly.
Keir Fraser [Mon, 20 Oct 2008 14:08:24 +0000 (15:08 +0100)]
blktap: Handle qcow backing files correctly.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
17 years agoxend: Stub out vscsi_get_scsidevices() until issues are addressed.
Keir Fraser [Mon, 20 Oct 2008 14:05:48 +0000 (15:05 +0100)]
xend: Stub out vscsi_get_scsidevices() until issues are addressed.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>